<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>管理后台</title>
    <!-- Tell the browser to be responsive to screen width -->
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
    <!-- Bootstrap 3.3.4 -->
    <link href="/Public/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css"/>
    <!-- FontAwesome 4.3.0 -->
    <link href="/Public/bootstrap/css/font-awesome.min.css" rel="stylesheet" type="text/css"/>
    <!-- Ionicons 2.0.0 --
    <link href="https://code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css" rel="stylesheet" type="text/css" />
    <!-- Theme style -->
    <link href="/Public/dist/css/AdminLTE.min.css" rel="stylesheet" type="text/css"/>
    <!-- AdminLTE Skins. Choose a skin from the css/skins 
    	folder instead of downloading all of them to reduce the load. -->
    <link href="/Public/dist/css/skins/_all-skins.min.css" rel="stylesheet" type="text/css"/>
    <!-- iCheck -->
    <link href="/Public/plugins/iCheck/flat/blue.css" rel="stylesheet" type="text/css"/>
    <!-- jQuery 2.1.4 -->
    <script src="/Public/plugins/jQuery/jQuery-2.1.4.min.js"></script>
    <script src="/Public/js/global.js"></script>
    <script src="/Public/js/myFormValidate.js"></script>
    <script src="/Public/bootstrap/js/bootstrap.min.js" type="text/javascript"></script>
    <script src="/Public/js/layer/layer-min.js"></script><!-- 弹窗js 参考文档 http://layer.layui.com/-->
    <script src="/Public/js/myAjax.js"></script>
    <script type="text/javascript">
        function delfunc(obj) {
            layer.confirm('确认删除？', {
                        btn: ['确定', '取消'] //按钮
                    }, function () {
                        $.ajax({
                            type: 'post',
                            url: $(obj).attr('data-url'),
                            data: {act: 'del', del_id: $(obj).attr('data-id')},
                            dataType: 'json',
                            success: function (data) {
                                if (data == 1) {
                                    layer.msg('操作成功', {icon: 1});
                                    $(obj).parent().parent().remove();
                                } else {
                                    layer.msg(data, {icon: 2, time: 2000});
                                }
                                layer.closeAll();
                            }
                        })
                    }, function (index) {
                        layer.close(index);
                        return false;// 取消
                    }
            );
        }

        //全选
        function selectAll(name, obj) {
            $('input[name*=' + name + ']').prop('checked', $(obj).checked);
        }

        function get_help(obj) {
            layer.open({
                type: 2,
                title: '帮助手册',
                shadeClose: true,
                shade: 0.3,
                area: ['90%', '90%'],
                content: $(obj).attr('data-url'),
            });
        }

        function delAll(obj, name) {
            var a = [];
            $('input[name*=' + name + ']').each(function (i, o) {
                if ($(o).is(':checked')) {
                    a.push($(o).val());
                }
            })
            if (a.length == 0) {
                layer.alert('请选择删除项', {icon: 2});
                return;
            }
            layer.confirm('确认删除？', {btn: ['确定', '取消']}, function () {
                    $.ajax({
                        type: 'get',
                        url: $(obj).attr('data-url'),
                        data: {act: 'del', del_id: a},
                        dataType: 'json',
                        success: function (data) {
                            if (data == 1) {
                                layer.msg('操作成功', {icon: 1});
                                $('input[name*=' + name + ']').each(function (i, o) {
                                    if ($(o).is(':checked')) {
                                        $(o).parent().parent().remove();
                                    }
                                })
                            } else {
                                layer.msg(data, {icon: 2, time: 2000});
                            }
                            layer.closeAll();
                        }
                    })
                }, function (index) {
                    layer.close(index);
                    return false;// 取消
                }
            );
        }
    </script>
</head>
<body style="background-color:#ecf0f5;">
 

<div class="wrapper">
    <div class="breadcrumbs" id="breadcrumbs">
	<ol class="breadcrumb">
	<?php if(is_array($navigate_admin)): foreach($navigate_admin as $k=>$v): if($k == '后台首页'): ?><li><a href="<?php echo ($v); ?>"><i class="fa fa-home"></i>&nbsp;&nbsp;<?php echo ($k); ?></a></li>
	    <?php else: ?>    
	        <li><a href="<?php echo ($v); ?>"><?php echo ($k); ?></a></li><?php endif; endforeach; endif; ?>          
	</ol>
</div>

    <section class="content">
        <div class="row">
            <div class="col-sm-12">
                <div class="box">
                    <div class="box-header">
                        <h3 class="box-title">增加分类</h3>
                    </div>
                    <!-- /.box-header -->
                    <form action="<?php echo U('Evaluation/categoryHandle');?>" method="post" class="form-horizontal">
                        <div class="box-body">
                            <div class="form-group">
                                <label class="control-label col-sm-2">分类名称</label>
                                <div class="col-sm-4">
                                    <input type="text" placeholder="名称" class="form-control" style="width:500px" name="cat_name" value="<?php echo ($cat_info["cat_name"]); ?>">
                                </div>
                                <div class="col-sm-4">&nbsp;</div>
                            </div>
                            <div class="form-group">
                                <label class="control-label col-sm-2">上级分类</label>
                                <div class="col-sm-8">
                                    <select class="small form-control" style="width:200px" tabindex="1" name="parent_id">
                                        <option value="0">顶级分类</option>
                                        <?php echo ($cat_select); ?>
                                    </select>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="control-label col-sm-2">显示排序</label>
                                <div class="col-sm-8">
                                    <input type="text" placeholder="50" class="form-control" style="width:200px" name="sort_order" value="<?php echo ($cat_info["sort_order"]); ?>">
                                    <span class="help-inline"></span>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="control-label col-sm-2">扣除金额</label>
                                <div class="col-sm-8">
                                    <input type="number" placeholder="0" class="form-control" style="width:100px"
                                           name="deduct_money" value="<?php echo ($cat_info['deduct_money']?$cat_info['deduct_money']:0); ?>">
                                    <span class="help-inline"></span>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="control-label col-sm-2">选项类型</label>
                                <div class="col-sm-8">
                                    <div class="col-sm-2">
                                        <label><input type="radio" name="type" value="1"
                                            <?php if($cat_info[is_can] == 1): ?>checked="checked"<?php endif; ?>> 单选 </label>
                                    </div>
                                    <div class="col-sm-3">
                                        <label><input type="radio" name="type" value="2"
                                            <?php if($cat_info[is_can] == 2): ?>checked="checked"<?php endif; ?>> 多选</label>
                                    </div>
                                    <div class="col-sm-3">
                                        <label><input type="radio" name="type" value="3"
                                            <?php if($cat_info[is_can] == 3): ?>checked="checked"<?php endif; ?>> 多选可不选</label>
                                    </div>
                                    <div class="col-sm-3">
                                        <label><input type="radio" name="type" value="4"
                                            <?php if($cat_info[is_can] == 4): ?>checked="checked"<?php endif; ?>> 单选可不选</label>
                                    </div>
                                    <span class="help-inline"></span>
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="control-label col-sm-2">是否可选</label>
                                <div class="col-sm-8">
                                        <div class="col-sm-2">
                                            <label><input type="radio" name="is_can" value="1"
                                                <?php if($cat_info[is_can] == 1): ?>checked="checked"<?php endif; ?>> 可选 </label>
                                        </div>
                                        <div class="col-sm-3">
                                            <label><input type="radio" name="is_can" value="2"
                                                <?php if($cat_info[is_can] == 2): ?>checked="checked"<?php endif; ?>> 不可选</label>
                                        </div>
                                    <span class="help-inline"></span>
                                </div>
                            </div>
                        </div>
                        <div class="box-footer">
                            <input type="hidden" name="act" value="<?php echo ($act); ?>">
                            <input type="hidden" name="cat_id" value="<?php echo ($cat_info["cat_id"]); ?>">
                            <input type="hidden" name="category_id" value="<?php echo ($category_id); ?>">
                            <button type="reset" class="btn btn-primary"><i class="icon-ok"></i>重填</button>
                            <button type="submit" class="btn btn-primary pull-right"><i class="icon-ok"></i>提交</button>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </section>
</div>
</body>
</html>